fix(core): prevent null outputContent #1134
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
in the BakeStatus that JobExecutorLocal.updateStatus returns.
Before this change, if the output of e.g. helm template is an empty string, the BakeStatus object that JobExecutorLocal.updateStatus returns is null, and HelmTemplateUtils.removeTestsDirectoryTemplates throws a NullPointerException.
HelmBakeManifestService.bake calls BakeManifestService.doBake which calls JobExecutorLocal.updateStatus, and then HelmBakeManifestService.bake calls HelmTemplateUtils.removeTestsDirectoryTemplates with the resulting String.
With this change, removeTestsDirectoryTemplates gets an empty string, and so the bake manifest endpoint (e.g. POST /api/v2/manifest/bake/helm) returns an empty Artifact.
Note that there's no Bake Manifest YAML link in bake manifest stages with empty bakes, but this still feels like progress.
As well, without a corresponding change to clouddriver (spinnaker/clouddriver#6337) to handle a null KubernetesManifest, there's still a clouddriver crash in a deploy manifest that consumes the output of this bake, but again, progress.
FWIW this is effectively a followup to #362. That PR added outputContent and there's still only the one place in the code that uses it. So, there aren't other behavior changes to consider.